import React from "react";

import StoFilter, { FilterType } from "../components/StoFilter";
import { getStudents } from "../common/mockdata";

const students = getStudents(2);

const filters = [
  {
    type: FilterType.TYPE_STRING,
    key: "name",
    placeholder: "请输入用户姓名",
  },

  {
    type: FilterType.TYPE_SELECT,
    key: "gender",
    placeholder: "性别",
    options: ["男", "女", "死变态"],
  },

  {
    type: FilterType.TYPE_NUMBER,
    key: "score",
    placeholder: "分数",
  },
];

const onDataFiltered = (newArr: Record<string, any>[]) => {
  console.log("onFiltered", newArr);
};

export default function FilterDemo() {
  return (
    <div>
      <h3>FilterDemo</h3>
      <StoFilter
        width={800}
        filters={filters}
        dataArr={students}
        onDataFiltered={onDataFiltered}
      ></StoFilter>
    </div>
  );
}
